<template>
	<view>
		<scroll-view scroll-x class="bg-white nav">
			<view class="flex text-center">
				<view class="cu-item flex-sub" :class="index==TabCur?'text-red cur':''" v-for="(item,index) in tabList"
					:key="index" @tap="tabSelect" :data-id="index">
					{{item.title}}
				</view>
			</view>
		</scroll-view>
		<view v-if="dataObj === null || dataObj.length === 0" class="padding-xs align-center">
			<view class="flex-sub text-center padding-top-xl">
				<view class="solid-bottom text-xsl padding">
					<text class=" cuIcon-new text-red"></text>
				</view>
				<view class="padding text-grey">这里还空空如也</view>
			</view>
		</view>
		<view v-else class="cu-list menu">
			<view class="cu-item arrow" v-for="(item,index) in dataObj" :key="index" @click="goDetail(item.id)">
				<view class="content padding-tb-sm">
					<view>
						{{item.title}}
					</view>
					<!-- <view class="text-gray text-sm">
						<text class="cuIcon-infofill margin-right-xs"></text> 小目标还没有实现！
					</view> -->
				</view>
				<view class="action"> </view>
			</view>
		</view>
	</view>

</template>

<script>
	import {
		org_list
	} from '@/common/api/api.js';

	export default {
		data() {
			return {
				TabCur: 0,
				tabList: [{
					title: "地区校友会",
					code: "0"
				}, {
					title: "年级校友会",
					code: "1"
				}],
				dataObj: []
			};
		},
		onLoad() {
			this.getData()
		},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.getData()
			},
			getData() {
				org_list({
					type: this.TabCur + ""
				}).then(res => {
					this.dataObj = this.$s.res(res)
				})
			},
			goDetail(e) {
				uni.navigateTo({
					url: './detail?id=' + e
				})
			},
		}
	}
</script>

<style>
</style>